<!DOCTYPE html>
<!-- ng-app -->
<html lang="en" ng-app="app">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script src="../../../js/plugins/angular/angular.min.js" type="text/javascript"></script>
</head>
<body>
    <div ng-controller="cont">
        <div class="{{cls}}">{{show}}</div>
        <button ng-click="onClick()">点我</button>
    </div>

    <script>
        var app = angular.module('app',[]);
        app.config(function ($controllerProvider) {
            $controllerProvider.register('cont',['$scope',function ($scope) {
                $scope.cls = '';
                $scope.onClick = function(){
                    $scope.cls = "show";
                    $scope.show = "点击后显示的内容";
                }
            }]);
        })

        /* 以下两句等同 */
//        app.config(function ($controllerProvider) {
//            $controllerProvider.register('cont',['$scope',function ($scope) {
//                // 控制器代码
//            }]);
//        })
//
//        app.controller('cont',['$scope',function ($scope) {
//            // 控制器代码
//        }])
    </script>
</body>
</html>